package cn.laixueit.controller;

import cn.laixueit.pojo.search.Goods;
import cn.laixueit.pojo.search.PageRequest;
import cn.laixueit.result.PageResult;
import cn.laixueit.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SearchController {

    @Autowired
    private SearchService searchService;

    @PostMapping("/search")
    public PageResult<Goods> search(@RequestBody PageRequest pageRequest){
        PageResult<Goods>  goodsPage =  searchService.search(pageRequest);
        return goodsPage;
    }
}
